<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="js/vue.js"></script>
    <style>
        
    </style>
</head>
<body>
    <div id="box">
        <my-nav>
            <button @click="isShow=!isShow">显示/隐藏</button>
        </my-nav>
        <sidebar v-show="isShow"></sidebar>
    </div>
    <script>
        Vue.component("myNav",{
            template:`
                <div>
                   导航---<slot></slot>
                </div>
            `
        })
        Vue.component("sidebar",{
            template:`
                <ul>
                   <li>li1</li>
                   <li>li2</li>
                   <li>li3</li>
                   <li>li4</li>
                </ul>
            `
        })
       
        const vm = new Vue({
            el:"#box",
            data:{
                isShow:true
            }
        })
    </script>
</body>
</html>